package per.hx.bs.base;

import org.springframework.stereotype.Controller;
import per.hx.bs.entity.sys.SysUserDO;
import per.hx.bs.service.ShiroService;
import per.hx.bs.util.ShiroUtils;
import per.hx.bs.util.SpringUtils;

/**
 * @author HuXing
 * @date ate 2018/3/11  13:23
 */
@Controller
public class BaseController {

    public SysUserDO getUser() {

        ShiroService shiroService = SpringUtils.getBean(ShiroService.class);
        return shiroService.getUserDOById(ShiroUtils.getUser().getUserId());
    }

    public Long getUserId() {
        return ShiroUtils.getUser().getUserId();
    }

    protected String getUserName() {
        return ShiroUtils.getUser().getUserName();
    }

    public String getName() {
        return ShiroUtils.getUser().getName();
    }

}
